new Vue({
    el: '#main',
    data: {
        userCode: '',
        source: '',
        title: '',
        content: '',
        activityCode: '201709_GLDH',
        shareId: ''
    },
    mounted () {
        this.init()
        this.maidian('23102')
        this.getShareData()
    },
    methods: {
        init () {
            this.userCode = this.getUrlParam('userCode') || this.getUrlParam('usercode') || ''
            this.source = this.getUrlParam('source') || 'teamGameDetail'
            this.title = this.getUrlParam('title') || ''
            this.content = this.getUrlParam('content') || ''
            this.shareId = this.getUrlParam('shareid') || ''
        },
        joinGame () {
           // window.location.href = 'https://fy.gtja.com/m/app/nrng/register.jsp?userCode=' + this.userCode + '&activityCode=201709_GLDH'
            window.location.href = 'https://dl.app.gtja.com/nrng/share/share.register.html?userCode=' + this.userCode +'&activityCode=201709_GLDH'
        },
        getShareData () {
            var title = this.title
            var content = this.content
            var icon = 'https://dl.app.gtja.com/web/gulindahui/share/gulinshare.jpg'
            window.weixinShare(title, content, icon, window.location.href)
        },
        maidian (tdId) {
            var TDAPP = window.TDAPP
            var kv = {
                usercode: this.userCode,
                source: this.source
            }
            TDAPP.onEvent(tdId, '', kv)
            TDAPP.send()
        },
        getUrlParam (name) {
            var url = decodeURI(location.search)
            var theRequest = new Object()
            if (Number(url.indexOf('?')) !== -1) {
                var str = url.substr(1)
                var strs = str.split('&')
                for (var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1])
                }
            }
            return theRequest[name]
        }
    }
})